<?php
class CommentWidget extends HomeAction{

    public function render($data){

          	$Comment=M('Comment');

            $sql['where']['comm_content_id']=$_GET['id'];
            $sql['where']['status']=1;
            $list=$this->_select('comment',$sql);
			      $j=count($list);
          	for($i=0;$i<$j;$i++){
          		if($list[$i]['pid']!=null){
          			foreach($list as $k=>$v){
          				if($v['id']==$list[$i]['pid']){
          					$list[$i]['pid_username']=$v['comm_username'];
          					$list[$i]['pid_content']=$v['comm_content'];
          				}
          			}
          		}
          	}

          $this->assign('commentList',$list);
          $this->display(dirname(__FILE__).'/Comment.html');

    } 

}